package com.hljx.job;

import com.hljx.entity.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.batch.MyBatisBatchItemWriter;
import org.mybatis.spring.batch.builder.MyBatisBatchItemWriterBuilder;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @BelongsProject: hljx
 * @BelongsPackage: com.hljx.job
 * @Author: lp
 * @CreateTime: 2023-10-23  08:57
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Configuration
public class Writer {

    @StepScope
    @Bean(name = "adviceItemWriter")
    public MyBatisBatchItemWriter<AdviceItem> itemWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<AdviceItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.AdviceItemMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "ifFreeItemItemWriter")
    public MyBatisBatchItemWriter<ListItem> ifFreeItemItemWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IfFeeitemlistMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "ipMomDodWriter")
    public MyBatisBatchItemWriter<ListItem> ipMomDodWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IpmomdodMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "CpoeProjectDischargeExeWriter")
    public MyBatisBatchItemWriter<ListItem> CpoeProjectDischargeExeWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.CpoeProjectDischargeExeMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "opRecordWriter")
    public MyBatisBatchItemWriter<ListItem> opRecordWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.OpRecordMapper.insertOpRecord")
                .build();
    }

    @StepScope
    @Bean(name = "ipMonMexWriter")
    public MyBatisBatchItemWriter<ListItem> ipMonMexWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IpmonmexMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "unDrugDetailWriter")
    public MyBatisBatchItemWriter<ListItem> unDrugDetailWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.UndrugDetailMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "clinicInvoiceWriter")
    public MyBatisBatchItemWriter<ListItem> clinicInvoiceWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.ClinicInvoiceInfoMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "iiBedUseRecordWriter")
    public MyBatisBatchItemWriter<ListItem> iiBedUseRecordWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IiBeduserecordMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "iiShiftDataWriter")
    public MyBatisBatchItemWriter<ListItem> iiShiftDataWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IiShiftdataMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "incomeExpensesWriter")
    public MyBatisBatchItemWriter<ListItem> incomeExpensesWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IncomeExpensesMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "llOneBackExpensesWriter")
    public MyBatisBatchItemWriter<ListItem> llOneBackExpensesWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.LlOneBackExpensesMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "mrmsbaseWriter")
    public MyBatisBatchItemWriter<ListItem> mrmsbaseWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.MrmsbaseMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "mrmsdymrWriter")
    public MyBatisBatchItemWriter<ListItem> mrmsdymrWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.MrmsdymrMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "opApplyWriter")
    public MyBatisBatchItemWriter<ListItem> opApplyWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.OpApplyMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "rRegisterWriter")
    public MyBatisBatchItemWriter<ListItem> rRegisterWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.RRegisterMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "ordSeedoctrecordWriter")
    public MyBatisBatchItemWriter<ListItem> ordSeedoctrecordWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.OrdSeedoctrecordMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "rMzClassCollectYardWriter")
    public MyBatisBatchItemWriter<ListItem> rMzClassCollectYardWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.RMzClassCollectYardMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "rStatMzClassCollectWriter")
    public MyBatisBatchItemWriter<ListItem> rStatMzClassCollectWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.RStatMzClassCollectMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "rStatMzCollectWriter")
    public MyBatisBatchItemWriter<ListItem> rStatMzCollectWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.RStatMzCollectMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "iaFeelistWriterMybatis")
    public MyBatisBatchItemWriter<IaFeelist> iaFeelistWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<IaFeelist>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.IaFeelistMapper.insert")
                .build();
    }

    @StepScope
    @Bean(name = "mrmsbasetimeWriterMybatis")
    public MyBatisBatchItemWriter<Mrmsbasetime> mrmsbasetimeWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<Mrmsbasetime>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.MrmsbasetimeMapper.insert")
                .build();
    }

    @StepScope
    @Bean(name = "privDeptWriterMybatis")
    public MyBatisBatchItemWriter<PrivDept> privDeptWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<PrivDept>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.PrivDeptMapper.insert")
                .build();
    }

    @StepScope
    @Bean(name = "rDepartmentWriterMybatis")
    public MyBatisBatchItemWriter<RDepartment> rDepartmentWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<RDepartment>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.RDepartmentMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "rEmployeeWriterMybatis")
    public MyBatisBatchItemWriter<REmployee> rEmployeeWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<REmployee>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.REmployeeMapper.insertAll")
                .build();
    }


    @StepScope
    @Bean(name = "VmHdTreatWriterMybatis")
    public MyBatisBatchItemWriter<ListItem> VmHdTreatWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.VmHdTreatMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "VmHdTreatXgWriterMybatis")
    public MyBatisBatchItemWriter<ListItem> VmHdTreatXgWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.VmHdTreatXgMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "MedOperationMasterWriterMybatis")
    public MyBatisBatchItemWriter<ListItem> MedOperationMasterWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.MedOperationMasterMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "vHljxFeedetailWriter")
    public MyBatisBatchItemWriter<ListItem> vHljxFeedetailWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.VHljxFeedetailMapper.insertAll")
                .build();
    }

    @StepScope
    @Bean(name = "vCssdWorkloadWriter")
    public MyBatisBatchItemWriter<ListItem> vCssdWorkloadWriterMybatis(@Qualifier("sysSqlSessionFactory") SqlSessionFactory writeSqlSessionFactory, @Qualifier("sysSqlSessionTemplate") SqlSessionTemplate sqlSessionTemplate) {
        log.info("itemWriter~~~~~~~~~~~~~");
        return new MyBatisBatchItemWriterBuilder<ListItem>()
                .sqlSessionFactory(writeSqlSessionFactory)
                .sqlSessionTemplate(sqlSessionTemplate)
                .statementId("com.hljx.mapper.sys.VCssdWorkloadMapper.insertAll")
                .build();
    }


}
